﻿using Prism.Commands;
using Prism.Mvvm;
using Prism.Regions;
using System;
using static ImTools.ImMap;

namespace Manson.PrismWPFUIBase.ViewModels
{
    public class MainWindowViewModel : BindableBase
    {
        private string _title = "Manson   ||    智能制造控制系统";
        public string Title
        {
            get { return _title; }
            set { SetProperty(ref _title, value); }
        }

        private IRegionManager _regionManager;
        public MainWindowViewModel(IRegionManager regionManager)
        {
            _regionManager = regionManager;
            
            _regionManager.RegisterViewWithRegion ("ContentRegion", "UCA");
        }

        private DelegateCommand<string> _openViewCommand;
        public DelegateCommand<string> OpenViewCommand => _openViewCommand ?? (_openViewCommand = new DelegateCommand<string>(OpenView, CanExecuteButtonCommand));

      
        private void OpenView(string value)
        {
            _regionManager.RequestNavigate("ContentRegion", value);
        }
        private bool CanExecuteButtonCommand(string value)
        {
            return true;
        }
    }
}
